[SCIEDU-111] Implement admin experiment management - #52
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a7610663fa
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| maxAttempts: Number(draft.maxAttempts), | ||
| allowRetry: Number(draft.maxAttempts) > 1, | ||
| showScore: true, | ||
| showExplanations: draft.result === "explanations", | ||
| gradingMode: "AUTOMATIC", |
There was a problem hiding this comment.
Preserve unsupported configuration fields when editing
When an existing experiment uses a valid configuration that this form cannot represent—such as gradingMode: "MANUAL", showScore: false, or the NEVER answer-release mode—clicking Next or saving synthesizes a new configuration with automatic grading and score display enabled (and maps NEVER to course completion). This also occurs when extending an ACTIVE experiment, although those settings appear locked, so the PUT can silently change live experimental conditions or be rejected instead of updating only the end time; preserve the loaded values for fields the user cannot edit.
Useful? React with 👍 / 👎.
| return api<ExperimentDetail>("/api/experiments", { | ||
| method: "POST", | ||
| body: JSON.stringify(payload), | ||
| }); |
There was a problem hiding this comment.
Keep demo-mode experiment mutations local
With VITE_ADMIN_DEMO_MODE=true, the routes bypass authentication and all experiment reads return demo fixtures, but this mutation still POSTs to VITE_BACKEND_BASE_URL; the update and status mutations below behave the same way. Consequently the supposedly local preview either fails as soon as the user advances the creation flow, or, if the browser has ambient credentials, unexpectedly creates or modifies backend data while displaying unrelated demo state. Add demo-mode mutation handling rather than calling the configured API.
Useful? React with 👍 / 👎.
| ? styles.navActive | ||
| : undefined | ||
| } | ||
| onClick={() => navigate("/admin")} |
There was a problem hiding this comment.
Route the people navigation to the people view
When a user clicks 人員管理 from any experiment-management page, this sends them to /admin, where AdminDashboardPage initializes activeSection to "overview"; therefore the click opens the overview rather than the requested people-management view. Pass a route state/query/hash that the dashboard consumes, or give the people view its own route.
Useful? React with 👍 / 👎.
Type of changes
Purpose
Additional Information